package com.server.configuration;

import com.common.properties.ErnieBotProperties;
import com.common.utils.ERNIEBotUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class ERNIEBotConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public ERNIEBotUtil ERNIEBotUtil(ErnieBotProperties ernieBotProperties){
        log.info("创建文言一心token获取工具对象:{}",ernieBotProperties);
        return new ERNIEBotUtil(ernieBotProperties.getAPI_KEY()
        ,ernieBotProperties.getSECRET_KEY());
    }
}
